<?php
/**
 * RedCross Application
 *
 * @copyright Copyright (c) 2010, Kristian Stokke Tryggestad, Rune Vikestad, Andreas Flaten Wist, Simen Nicolai Echholt, Ole Henrik Jahren
 */

/**
 * Form for adding events
 *
 * @category    RedCross
 * @package     Admin_Form_Shift
 */
class Admin_Form_Shift_Edit extends RedCross_Form
{

	public function init()
	{
		$this->addPrefixPath('RedCross_Form_Element', 'RedCross/Form/Element', 'element');
		
		$this->setAttrib('id','addShiftForm');
        
 		$this->addElement('text', 'name', array(
 			'filters'		=> array('StringTrim'),
 			'validators'	=> array(
 				array('StringLength', true, array(1, 32)),
            ),
            'required'	=> true,
            'label'		=> 'Navn',
 		));
 		
		$this->addElement('text', 'appearance_date', array(
            'validators' => array('Date'),
			'required'	=> true,
			'label' => 'Oppmøtedato:'
		));
		
		$this->addElement('time', 'appearance_time', array(
			'required'	=> true,
			'validators'	=> array(
				array('Time', true, array('name' => 'appearance_time')),
			),
			'label' => 'Oppmøtetidspunkt:'
		));
		
		
		$this->addElement('text', 'from_date', array(
			'filters' => array('StringTrim'),
			'validators' => array(
				array('Date', true),
			//	array('ValidDate', true, array('type' => 'from_date')),
			),
			'required' => true,
			'label' => 'Startdato:'
		));
		
		$this->addElement('time', 'from_time', array(
			'validators'	=> array(
				array('Time', true, array('name' => 'from_time', 'ajax' => true)),
			),
            'required' => true,
			'label' => 'Starttidspunkt:'
		));
		
		$this->addElement('text', 'to_date', array(
			'filters'		=> array('StringTrim'),
			'validators'	=> array(
				array('Date', true),
			//	array('ValidDate', true, array('type' => 'to_date')),
			),
			'required' => true,
			'label' => 'Slutt Dato:'
		));
		
		$this->addElement('time', 'to_time', array(
			'required'	=> true,
			'validators'	=> array(
				array('Time', true, array('name' => 'to_time', 'ajax' => true)),
			),
			'label' => 'Sluttidspunkt:'
		));
 		
 		$this->addElement('textarea', 'special_description', array(
 			'filters'		=> array('StringTrim'),
 			'validators'	=> array(
 				array('StringLength', true, array(1, 255)),
            ),
            'rows' => '5',
            'cols' => '60',
            'label' => 'Spesiell beskrivelse?'
 		));
 		
 		$this->addElement('textarea', 'equipment_list', array(
 			'filters' => array('StringTrim'),
 			'validators' => array(
 				array('StringLength', true, array(1, 255)),
            ),
            'rows' => '5',
            'cols' => '60',
            'label' => 'Utstyr:'
 		));
		
		$this->addElement('submit', 'submitEditForm', array(
			'label' => 'Lagre',
			'required' => true
		));

        $this->getElement('submitEditForm')->setDecorators($this->_buttonElementDecorators);
 	}
	
 }
